﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgNetComponents.Design.Attributes
{
    /// <summary>
    /// Gets ReadOnlyAttribute base on property value type
    /// </summary>
    public class EditableByPropertyValueTypeAttribute : DynamicTypeDependentAttribute
    {
        /// <summary>
        /// Creates EditableByPropertyValueTypeAttribute instance
        /// </summary>
        /// <param name="property"></param>
        /// <param name="types"></param>
        public EditableByPropertyValueTypeAttribute(string property, params Type[] types)
            : base(property, types)
        {
        }
        /// <summary>
        /// Returns ReadOnlyAttribute(!valuesMatch)
        /// </summary>
        /// <param name="valuesMatch"></param>
        /// <returns></returns>
        protected override Attribute GetAttribute(bool valuesMatch)
        {
            return new System.ComponentModel.ReadOnlyAttribute(!valuesMatch);
        }
    }
}
